using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;

public class UICraftSolt : UIItemSlot
{
    [SerializeField] private TextMeshProUGUI itemName;
    [SerializeField] private Image itemIcon;
    private void OnEnable()
    {
        UpdateItemSlot(inventoryItem);
    }
	public void Setup(EquipItemData data)
	{
        if (data == null) return;
		inventoryItem.itemData=data;
		itemIcon.sprite = data.itemSprite;
		itemName.text = data.itemName;
	}
	
    public override void OnPointerDown(PointerEventData eventData)
    {
        ui.craftWindow.gameObject.SetActive(true);
        ui.craftWindow.Setup(inventoryItem.itemData as EquipItemData);
    }
    public override void UpdateItemSlot(InventoryItem item)
    {
        if (inventoryItem == null) return;
        itemName.text = inventoryItem.itemData.itemName;
        itemIcon.color = Color.white;
        itemIcon.sprite = inventoryItem.itemData.itemSprite;
    }
}
